﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeBehind="List.aspx.cs" Inherits="SRS.List" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

  <div class="SRS_PageLayout">

    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
        <DataControls>
            <asp:DataControlReference ControlID="GridView1" />
        </DataControls>
    </asp:DynamicDataManager>

    <h2 class="SRSSubHeader"><%= table.DisplayName%></h2>
   
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>

                <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
                    HeaderText="List of validation errors" Cssclass="SRSValidator" />
                <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" Cssclass="SRSValidator" />
                <asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" />
                        <asp:DynamicFilter runat="server" ID="DynamicFilter" />
                    </ItemTemplate>
                </asp:QueryableFilterRepeater>

<%-- ########################################################################################################################## --%>

                <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
                AllowPaging="True" AllowSorting="True" Cssclass="SRSGridView"
                RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
                <Columns>
                    <asp:TemplateField> 
                        <ItemTemplate>
                                <asp:Panel CssClass="SRSModifierHover" ID="PopupMenu" runat="server">
                                    <div class="SRSModifierActions">
                                        <div>
                                            &nbsp;
                                            <img id="Img1" runat="server" src="../../Images/iconsets/iconic/1338159396_magnifying_glass.png" alt="View Details" />
                                            <asp:DynamicHyperLink ID="DynamicHyperLink1" runat="server" Text="View Details" /> 
                                        </div>
                                        <div>
                                            &nbsp;
                                            <img id="Img2" runat="server" src="../../Images/iconsets/iconic/1338159435_pen.png" alt="Edit Record" />
                                            <asp:DynamicHyperLink ID="DynamicHyperLink2" runat="server" Action="Edit" Text="Edit Record" /> 
                                        </div>
                                        <div>
                                            <br />
                                            &nbsp;
                                            <img id="Img3" runat="server" src="../../Images/iconsets/iconic/1338159411_trash_stroke.png" alt="Delete Record" />
                                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" Text="Delete Record"
                                                OnClientClick='return confirm("Are you sure you want to delete this item?");' /> 
                                        </div>
                                    </div>
                                </asp:Panel>
                                <asp:Panel ID="PanelActions" runat="server">
                                    <table width="100%">
                                        <tr>
                                        <td width="100%"><div style="text-align: center">...</div></td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                                <asp:HoverMenuExtender ID="hme2" runat="Server"
                                    HoverCssClass="popupHover"
                                    PopupControlID="PopupMenu"
                                    PopupPosition="Left"
                                    TargetControlID="PanelActions"
                                    PopDelay="25" />
                        </ItemTemplate>
                            <%--
                            <EditItemTemplate>  
                                <asp:Panel ID="PanelActions" runat="server" Width="80%">
                                    <table width="100%">
                                        <tr><td></td></tr>
                                    </table>
                                </asp:Panel>
                                <asp:HoverMenuExtender ID="hme1" runat="Server"
                                    TargetControlID="PanelActions"
                                    PopupControlID="PopupMenu"
                                    HoverCssClass="popupHover"
                                    PopupPosition="Right" />
                                <asp:Panel ID="PopupMenu" runat="server" CssClass="popupMenu" Width="80">
                                    <div style="border:1px outset white">
                                        <asp:LinkButton ID="LinkButton1" runat="server"
                                            CausesValidation="True" CommandName="Update" Text="Update" />
                                        <br />
                                        <asp:LinkButton ID="LinkButton2" runat="server"
                                            CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                                    </div>
                                </asp:Panel>
                            </EditItemTemplate>  
                            --%>
                    </asp:TemplateField>
                </Columns>

<%-- ########################################################################################################################## --%>

                <PagerStyle Cssclass="SRSFooter"/>        
                
                <PagerTemplate>
                    <asp:GridViewPager ID="GridViewPager1" runat="server" />
                </PagerTemplate>

                <EmptyDataTemplate>
                    There are currently no items in this table.
                </EmptyDataTemplate>

            </asp:GridView>

            <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" />
            
            <asp:QueryExtender TargetControlID="GridDataSource" ID="GridQueryExtender" runat="server">
                <asp:DynamicFilterExpression ControlID="FilterRepeater" />
            </asp:QueryExtender>

            <br /><br />

            <div class="SRSBottomHyperLink">
                <asp:DynamicHyperLink ID="InsertHyperLink" runat="server" Action="Insert">
                <img id="Img4" runat="server" src="../../Images/iconsets/picol/1338163695_badge_plus_32.png" alt="Insert New Record" />Insert New Record</asp:DynamicHyperLink>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
  </div>
</asp:Content>

